set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_C_STANDARD 99)
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_BUILD_TYPE "Debug")


if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
	set(DEL "rm")
else()
	set(DEL "del")
	set(ARM_TOOLS "C:/Program\ Files/DS-5\ v5.26.0/sw/ARMCompiler5.06u4/bin")
	set(CMAKE_FIND_ROOT_PATH "C:/Program\ Files/DS-5\ v5.26.0/sw/ARMCompiler5.06u4")
	set(CMAKE_SYSROOT "C:/Program\ Files/DS-5\ v5.26.0/sw/ARMCompiler5.06u4")
	set(CMAKE_ASM_COMPILER "${ARM_TOOLS}/armasm.exe")
	set(CMAKE_AR "${ARM_TOOLS}/armar.exe")
	set(CMAKE_LINKER "${ARM_TOOLS}/armlink.exe")
	set(CMAKE_C_COMPILER "${ARM_TOOLS}/armcc.exe")
	set(CMAKE_C_COMPILER_ID "ARMCC")

	set(CMAKE_C_FLAGS_INIT "--c99 -c --cpu Cortex-M4.fp -D__MICROLIB --li -g -O1 --apcs=interwork --split_sections -I")
	set(CMAKE_ASM_FLAGS_INIT "--c99 -c --cpu Cortex-M4.fp -D__MICROLIB --li -g -O1 --apcs=interwork --split_sections -I")

endif()

set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)

if(${CMAKE_BUILD_TYPE} EQUAL "Debug")
    set(CMAKE_C_FLAGS_INIT "${CMAKE_C_FLAGS_INIT} -g")
    set(CMAKE_ASM_FLAGS_INIT "${CMAKE_ASM_FLAGS_INIT} -g")
endif()

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
